package com.xqls.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xqls.dal.dao.RoleDao;
import com.xqls.dal.model.Role;
import com.xqls.dal.model.RoleExample;
import com.xqls.dal.service.RoleMapper;

@Repository 
public class RoleDaoImpl implements RoleDao{
    @Autowired private RoleMapper roleMapper;

	@Override
	public boolean insertRecord(Role record) {
		boolean isResult=false;
		if(this.roleMapper.insertForMycat(record)>0)
		{
			isResult=true;
		}
		return isResult;
	}

	@Override
	public boolean updateRecord(Role record) {
		boolean isResult=false;
		if(this.roleMapper.updateByPrimaryKey(record)>0)
		{
			isResult=true;
		}
		return isResult;
	}
	
	@Override
	public boolean deleteRecord(String roleId) {
		boolean isResult=false;
		if(this.roleMapper.deleteByPrimaryKey(roleId)>0)
		{
			isResult=true;
		}
		return isResult;
	}
	
	@Override
	public Role getLastRecord() {
		return this.roleMapper.getLastRecord();
	}
	
	@Override
	public List<Role> getListByExample(RoleExample example) {
		return this.roleMapper.selectByExample(example);
	}

	@Override
	public List<Role> getListByMap(Map<String, Object> map) {
		return this.roleMapper.getListByMap(map);
	}
}
